package com.xn.app.muying.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Html;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xn.app.muying.R;
import com.xn.app.muying.util.BaseActivity;
import com.zhuge.analysis.stat.ZhugeSDK;

/**
 * Created by Administrator on 2017/1/6.
 */
public class SheetExceptionReasonActivity extends BaseActivity implements View.OnClickListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sheetexceptionreason);
        initView();
    }

    private void initView() {
        TextView title_name = (TextView) findViewById(R.id.title_name);
        ImageView img_back = (ImageView) findViewById(R.id.img_back);
        TextView name = (TextView) findViewById(R.id.sheetexception_name);
        TextView status = (TextView) findViewById(R.id.sheetexception_status);
        TextView jianjie = (TextView) findViewById(R.id.sheetexception_jianjie);
        TextView conservationFocus_reason = (TextView) findViewById(R.id.conservationFocus_reason);
        TextView observationFocus_reason = (TextView) findViewById(R.id.observationFocus_reason);

        TextView reason = (TextView) findViewById(R.id.sheetexception_reason);
        if (getIntent().getStringExtra("reporterCategoryDisplayName") != null && !getIntent().getStringExtra("reporterCategoryDisplayName").equals("") && !getIntent().getStringExtra("reporterCategoryDisplayName").equals("null")) {
            title_name.setText(getIntent().getStringExtra("reporterCategoryDisplayName"));
        } else {
            if (getIntent().getStringExtra("chineseName") != null && !getIntent().getStringExtra("chineseName").equals("") && !getIntent().getStringExtra("chineseName").equals("null")) {
                title_name.setText(getIntent().getStringExtra("chineseName"));
            } else {
                title_name.setText("详情");
            }
        }

        name.setText(getIntent().getStringExtra("chineseName"));
        status.setText(getIntent().getStringExtra("statusDescription"));
        //指标介绍
        String introduction = getIntent().getStringExtra("introduction");
        if (introduction != null & !introduction.equals("") && !introduction.equals("null")) {
            jianjie.setText(Html.fromHtml(String.valueOf(Html.fromHtml(introduction))));
        } else {
            jianjie.setText("");
        }
        //异常原因
        String unusualCircumstances = getIntent().getStringExtra("unusualCircumstances");
        if (unusualCircumstances != null & !unusualCircumstances.equals("") && !unusualCircumstances.equals("null")) {
            reason.setText(Html.fromHtml(String.valueOf(Html.fromHtml(unusualCircumstances))));
        } else {
            reason.setText("");
        }
        //养护重点
        String conservationFocus = getIntent().getStringExtra("conservationFocus");
        if (conservationFocus != null & !conservationFocus.equals("") && !conservationFocus.equals("null")) {
            conservationFocus_reason.setText(Html.fromHtml(String.valueOf(Html.fromHtml(conservationFocus))));
        } else {
            conservationFocus_reason.setText("");
        }
        //观察重点
        String observationFocus = getIntent().getStringExtra("observationFocus");
        if (observationFocus != null & !observationFocus.equals("") && !observationFocus.equals("null")) {
            observationFocus_reason.setText(Html.fromHtml(String.valueOf(Html.fromHtml(observationFocus))));
        } else {
            observationFocus_reason.setText("");
        }
        img_back.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
    }
}
